﻿function getMyTime(){
date = new Date(); 
var h = date.getHours(); 
var m = date.getMinutes(); 
var s = date.getSeconds(); 
var timeStr = "现在是："+ date.getFullYear() + "年" + (date.getMonth()+1) + "月" + date.getDate() + "日"+"&nbsp;&nbsp;&nbsp;"; 
timeStr += h < 12 ? "上午" : (h < 18 ? "下午" : "晚上"); 
timeStr += (h % 12 < 10 ? "0" : "") + (h < 12 ? h : (h - 12)) + "时"; 
timeStr += (m < 10 ? "0" : "") + m + "分"; 
timeStr += (s < 10 ? "0" : "") + s + "秒" + "&nbsp;&nbsp;&nbsp;"; 
document.write(timeStr); 
myArray=new Array(6); 
myArray[0]="星期日 " 
myArray[1]="星期一 " 
myArray[2]="星期二 " 
myArray[3]="星期三 " 
myArray[4]="星期四 " 
myArray[5]="星期五 " 
myArray[6]="星期六 " 
weekday=date.getDay(); 
if (weekday==0 | weekday==6) 
{ 
document.write(myArray[weekday]) 
} 
else 
{ 
document.write(myArray[weekday]) 
} 
}
var gettime=function(){
var date = new Date();
document.write(date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate());
}